<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <rich:panel>
        <f:facet name="header">Seat Details</f:facet>


        <s:decorate id="seatNumber" template="layout/display.xhtml">
            <ui:define name="label">Seat number</ui:define>
            <h:outputText value="#{seatHome.instance.seatNumber}"/>
        </s:decorate>

        <s:decorate id="state" template="layout/display.xhtml">
            <ui:define name="label">State</ui:define>
            <h:outputText value="#{seatHome.instance.state}"/>
        </s:decorate>

        <div style="clear:both"/>

    </rich:panel>

    <div class="actionButtons">

        <s:button view="/SeatEdit.xhtml"
                    id="edit"
                 value="Edit"/>

        <s:button view="/#{empty seatFrom ? 'SeatList' : seatFrom}.xhtml"
                    id="done"
                 value="Done"/>

    </div>

    <rich:tabPanel switchType="ajax">

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/manytoone.gif" style="vertical-align: middle; padding-right: 4px;"/>Travel</h:panelGroup>
        </f:facet>
    <div class="association" id="travelParent">

        <h:outputText value="There is no travel associated with this seat."
                   rendered="#{seatHome.instance.travel == null}"/>

        <rich:dataTable var="_travel"
                   value="#{seatHome.instance.travel}"
                rendered="#{seatHome.instance.travel != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="travelTable">
            <h:column>
                <f:facet name="header">Id travel</f:facet>
                <h:outputText value="#{_travel.idTravel}"/>
            </h:column>
            <h:column>
                <f:facet name="header">City by to city id city</f:facet>
                <h:outputText value="#{_travel.cityByToCity.idCity}"/>
            </h:column>
            <h:column>
                <f:facet name="header">State by from state id state</f:facet>
                <h:outputText value="#{_travel.stateByFromState.idState}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Country by from country id country</f:facet>
                <h:outputText value="#{_travel.countryByFromCountry.idCountry}"/>
            </h:column>
            <h:column>
                <f:facet name="header">User id user</f:facet>
                <h:outputText value="#{_travel.user.idUser}"/>
            </h:column>
            <h:column>
                <f:facet name="header">State by to state id state</f:facet>
                <h:outputText value="#{_travel.stateByToState.idState}"/>
            </h:column>
            <h:column>
                <f:facet name="header">City by from city id city</f:facet>
                <h:outputText value="#{_travel.cityByFromCity.idCity}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Country by to country id country</f:facet>
                <h:outputText value="#{_travel.countryByToCountry.idCountry}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Name</f:facet>
                <h:outputText value="#{_travel.name}"/>
            </h:column>
            <h:column>
                <f:facet name="header">From lat</f:facet>
                <h:outputText value="#{_travel.fromLat}"/>
            </h:column>
            <h:column>
                <f:facet name="header">From lon</f:facet>
                <h:outputText value="#{_travel.fromLon}"/>
            </h:column>
            <h:column>
                <f:facet name="header">To lat</f:facet>
                <h:outputText value="#{_travel.toLat}"/>
            </h:column>
            <h:column>
                <f:facet name="header">To lon</f:facet>
                <h:outputText value="#{_travel.toLon}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Distance</f:facet>
                <h:outputText value="#{_travel.distance}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Travel state</f:facet>
                <h:outputText value="#{_travel.travelState}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Calculated rate</f:facet>
                <h:outputText value="#{_travel.calculatedRate}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Create date</f:facet>
                <h:outputText value="#{_travel.createDate}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Modify date</f:facet>
                <h:outputText value="#{_travel.modifyDate}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Delete date</f:facet>
                <h:outputText value="#{_travel.deleteDate}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Cron expression</f:facet>
                <h:outputText value="#{_travel.cronExpression}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Monday</f:facet>
                <h:outputText value="#{_travel.monday}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Tuesday</f:facet>
                <h:outputText value="#{_travel.tuesday}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Wednesday</f:facet>
                <h:outputText value="#{_travel.wednesday}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Thursday</f:facet>
                <h:outputText value="#{_travel.thursday}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Friday</f:facet>
                <h:outputText value="#{_travel.friday}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Saturday</f:facet>
                <h:outputText value="#{_travel.saturday}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Sunday</f:facet>
                <h:outputText value="#{_travel.sunday}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Begin date</f:facet>
                <h:outputText value="#{_travel.beginDate}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">End date</f:facet>
                <h:outputText value="#{_travel.endDate}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Single day</f:facet>
                <h:outputText value="#{_travel.singleDay}"/>
            </h:column>
            <h:column styleClass="action">
                <f:facet name="header">Action</f:facet>
                <s:link id="viewtravel"
                     value="View"
                      view="/Travel.xhtml">
                    <f:param name="travelIdTravel"
                           value="#{_travel.idTravel}"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </div>
    </rich:tab>

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/manytoone.gif" style="vertical-align: middle; padding-right: 4px;"/>User</h:panelGroup>
        </f:facet>
    <div class="association" id="userParent">

        <h:outputText value="There is no user associated with this seat."
                   rendered="#{seatHome.instance.user == null}"/>

        <rich:dataTable var="_user"
                   value="#{seatHome.instance.user}"
                rendered="#{seatHome.instance.user != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="userTable">
            <h:column>
                <f:facet name="header">Id user</f:facet>
                <h:outputText value="#{_user.idUser}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Login</f:facet>
                <h:outputText value="#{_user.login}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Password</f:facet>
                <h:outputText value="#{_user.password}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Name</f:facet>
                <h:outputText value="#{_user.name}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Surname</f:facet>
                <h:outputText value="#{_user.surname}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Birth date</f:facet>
                <h:outputText value="#{_user.birthDate}">
                    <s:convertDateTime type="date" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Create date</f:facet>
                <h:outputText value="#{_user.createDate}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Modify date</f:facet>
                <h:outputText value="#{_user.modifyDate}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Delete date</f:facet>
                <h:outputText value="#{_user.deleteDate}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Type</f:facet>
                <h:outputText value="#{_user.type}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Calculated rate</f:facet>
                <h:outputText value="#{_user.calculatedRate}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Enabled</f:facet>
                <h:outputText value="#{_user.enabled}"/>
            </h:column>
            <h:column styleClass="action">
                <f:facet name="header">Action</f:facet>
                <s:link id="viewuser"
                     value="View"
                      view="/User.xhtml">
                    <f:param name="userIdUser"
                           value="#{_user.idUser}"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </div>
    </rich:tab>

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/onetomany.gif" style="vertical-align: middle; padding-right: 4px;"/>Evaluations</h:panelGroup>
        </f:facet>
    <h:form styleClass="association" id="evaluationsChildren">

        <h:outputText value="There are no evaluations associated with this seat."
                   rendered="#{empty seatHome.evaluations}"/>

        <rich:dataTable value="#{seatHome.evaluations}"
                       var="_evaluation"
                  rendered="#{not empty seatHome.evaluations}"
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="evaluationsTable">
            <rich:column sortBy="#{_evaluation.idEvaluation}">
                <f:facet name="header">Id evaluation</f:facet>
                <h:outputText value="#{_evaluation.idEvaluation}"/>
            </rich:column>
            <rich:column sortBy="#{_evaluation.marks}">
                <f:facet name="header">Marks</f:facet>
                <h:outputText value="#{_evaluation.marks}"/>
            </rich:column>
            <rich:column sortBy="#{_evaluation.evalDate}">
                <f:facet name="header">Eval date</f:facet>
                <h:outputText value="#{_evaluation.evalDate}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </rich:column>
            <h:column>
                <f:facet name="header">Action</f:facet>
                <s:link id="selectevaluation"
                     value="Select"
                      view="/Evaluation.xhtml">
                    <f:param name="evaluationIdEvaluation"
                            value="#{_evaluation.idEvaluation}"/>
                    <f:param name="evaluationFrom" value="Seat"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </h:form>

    <div class="actionButtons">
        <s:button
               value="Add evaluation"
                view="/EvaluationEdit.xhtml">
            <f:param name="seatIdSeat"
                    value="#{seatHome.instance.idSeat}"/>
            <f:param name="evaluationFrom" value="Seat"/>
        </s:button>
    </div>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
